<%@ page language="java" isELIgnored="false" import="java.util.*"
	pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ include file="/include/header.jsp"%>
<html>
<head>
<title><s:text name="careLine.titleT"></s:text></title>
<link href="<%=request.getContextPath()%>/fare/lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
<link rev="stylesheet" media="all" href="<%=request.getContextPath() %>/fare/css/form_style.css" type="text/css" rel="stylesheet">
<link rev="stylesheet" media="all" href="${pageContext.request.contextPath}/fare/css/form_style.css" type="text/css" rel="stylesheet">
<script type="text/javascript" src="<%=request.getContextPath() %>/fare/js/jquery-1.6.4.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/fare/lib/ligerUI/js/ligerui.min.js"></script>
<script	src="<%=request.getContextPath()%>/fare/lib/jquery/jquery.form.js"	type="text/javascript"></script>

<link href='<%=request.getContextPath()%>/fare/js/cityquery/cityquery.css' rel="stylesheet" type="text/css" />
<script type='text/javascript' src='<%=request.getContextPath()%>/fare/js/cityquery/citylist.js'></script>
<script type='text/javascript' src='<%=request.getContextPath()%>/fare/js/cityquery/querycity.js'></script>

<!-- 圆角文本框 -->
<link href="<%=request.getContextPath() %>/fare/css/htc/htc.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
$(document).ready(function(){
	$('#depCity').querycity({'data' : citysFlight, 'tabs' : labelFromcity });
	$('#arrCity').querycity({'data' : citysFlight,'tabs' : labelFromcity });
	/* $('#depCity').querycity({'data':citysFlight,'tabs':labelFromcity,changeDoFusion: changeEvent});
	$('#arrCity').querycity({'data':citysFlight,'tabs':labelFromcity,changeDoFusion: changeEvent}); */
	$("#depCity").css({color:'black'});
	$("#arrCity").css({color:'black'});
});


function find(){
	var shwoDif=document.getElementById("share.showDifferent").value;
	if ($("#depCity").val() == '中文/拼音'){
		$("#depCity").val("");
	}
	if ($("#arrCity").val() == '中文/拼音'){
		$("#arrCity").val("");
	}
	if($.trim($("#depCity").val())!="" 
			&& $.trim($("#arrCity").val())!="" 
			&& $.trim($("#depCity").val())==$.trim($("#arrCity").val())){
		alert(shwoDif);
		return;
	}
	$("#lineForm").attr("action","<%=request.getContextPath()%>/usercareline/toView.action");
	$("#lineForm").submit();
}
function clearcontent(){	
	$("#depCity").val("");
	$("#arrCity").val("");
}
function add(){	
	var successAltert=document.getElementById("share.success").value;
	if(checkForm()){
		var url = "<%=request.getContextPath()%>/usercareline/save.action";
		$.ajax({
	        url : url,
	        data:{depCity:$('#depCityCode').val(),arrCity:$('#arrCityCode').val()},
	        dataType: 'json', 
	        cache : false, 
	        async : false,
	        type : "POST",
	       	success: function(data){
	       		if(data && data.hasOk){
	       			alert(successAltert);
	       			window.location.href = "<%=request.getContextPath()%>/usercareline/toView.action";
	       		}else{
	       			if(data) alert(data.message);
	       		}
	       	}
	    });
	}	
}
//验证非空 
function checkForm() { 
	var depA=document.getElementById("share.departureA").value;
	var arrA=document.getElementById("share.destinationA").value;
	var flag=true;
	var shwoDif=document.getElementById("share.showDifferent").value;
	if ($("#depCity").val() == ''|| $("#depCity").val() == '中文/拼音') {
		flag = false;
		alert(depA);
		return flag;
	}    		
	if ($("#arrCity").val() == ''||$("#arrCity").val() == '中文/拼音') {
		flag = false;
		alert(arrA);
		return flag;
	}
	if($("#depCity").val() ==$ ("#arrCity").val()){
		flag = false;
		alert(shwoDif);
	}
	return flag;
} 

function deleteLine(id){	
	var sureAlert=document.getElementById("share.sureDel").value;
	var successAltert=document.getElementById("share.success").value;
	if(confirm(sureAlert)){ 
		var url = "<%=request.getContextPath()%>/usercareline/delete.action";
		$.ajax({
	        url : url,
	        data:{id : id},
	        dataType: 'json', 
	        cache : false, 
	        async : false,
	        type : "POST",
	       	success: function(data){
	       		if(data && data.hasOk){
	       			alert(successAltert);
	       			window.location.href = "<%=request.getContextPath()%>/usercareline/toView.action";
	       		}else{
	       			if(data) alert(data.message);
	       		}
	       	}
	    });
	}	 
}
</script>

</head>
<body>
<%@ include file="/include/home/home_header.jsp" %>
<jsp:include page="/pages/system/feedback/feedback.jsp"></jsp:include>
<div class="main main_max">
	<div class="sideBar">
	<div class="box">
		<div class="location"><s:text name="share.currentL"/>：<s:text name="share.personC"/> &gt; <s:text name="airlines"/></div>
	</div>
	</div>
	<div class="form_body">
		<div class="main_max">
			<div class="form_table_tltle"><s:text name="careLine.myCareLineList"/></div>
			<%-- 查询form--%>
			<form id="lineForm" action="" method="post">
				
				<!--internationalization   -->
				<input type="hidden" id="share.sureDel" value="<s:text name="share.sureDel"/>" />
				<input type="hidden" id="share.showDifferent" value="<s:text name="share.showDifferent"/>" />
				<input type="hidden" id="share.success" value="<s:text name="share.success"/>" />
				<input type="hidden" id="share.departureA" value="<s:text name="share.departureA"/>" />
				<input type="hidden" id="share.destinationA" value="<s:text name="share.destinationA"/>" />
				
				<input type="hidden" name="result" id="result" value="${result}"/>
				<table width="0" border="0" cellpadding="0" cellspacing="0"
					class="form_table">
					<tr>
					<td> 
					<%-- <jsp:include page="/inc/flightSelect_en_Us.jsp"></jsp:include> --%>
					<c:if test="${language=='en_US'}">
						<jsp:include page="/inc/flightSelect_en_Us.jsp"></jsp:include>
		   			</c:if>
				 	<c:if test="${language=='zh_CN' or language=='other'}">
				 		<jsp:include page="/inc/flightSelect.jsp"></jsp:include>
					</c:if>
					
					</td>
					</tr>
				</table>
				<div class="form_but">
				
					
					<input type="button" onclick="javascript:add();" value="" 
					class="<s:i18n name='forms'><s:text name='forms.btn07'></s:text></s:i18n>" id="addbutton"/>
					<input type="button" onclick="javascript:clearcontent();" value="" 
					class="<s:i18n name='forms'><s:text name='forms.btn02'></s:text></s:i18n>" id="cancelbutton"/>
					
					<%-- <img
						src="<%=request.getContextPath() %>/fare/images/but_03.png"
						name="addbutton" id="addbutton" onclick="javascript:add();" />
					<img
						src="<%=request.getContextPath() %>/fare/images/but_02.png"
						name="cancelbutton" id="cancelbutton" onclick="javascript:clearcontent();" /> --%>
				</div>
			</form>
				<div class="high_10"></div>
				<form id="page_form">
				<div class="form_table_tltle"><s:text name="careLine.careLineList"/></div>
				<table width="0" border="0" cellspacing="0" cellpadding="0" class="form_list">
					<tr class="title">
						<td style="text-align: center"><s:text name="share.index"/></td>
						<td style="text-align: center"><s:text name="share.destination"/></td>
						<td style="text-align: center"><s:text name="share.departure"/></td>
						<td style="text-align: center"><s:text name="share.createT"/></td>
						<td style="text-align: center"><s:text name="share.operaion"/></td>
					</tr>
					<c:forEach items="${datas}" var="o" varStatus="vs">
					<tr >
						<td class="line" style="text-align: center">${vs.count}</td>
						<td class="line" style="text-align: center">${o.departcity}(${o.departcitycode})&nbsp;</td>
						<td class="line" style="text-align: center">${o.arrivalcity}(${o.arrivalcitycode})&nbsp;</td>
						<td class="line" style="text-align: center"><fmt:formatDate value="${o.createTime}" pattern="yyyy-MM-dd HH:mm:ss"/>&nbsp;</td>
						<td class="line" style="text-align: center">
						<a href="#" onclick="javascript:deleteLine(${o.id});"><img src="${baseURL}/images/del_cli.png"/></a></td>
					</tr>
					</c:forEach>
				</table>
				<form>
		</div>
		
	</div>
	</div>

	<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
	<%@ include file="/include/home/home_footer.jsp" %> 
</body>
<style type="text/css">
td {
	text-align: center;
}
</style>
</html>
